<template>
	<div>
		<table class="table">
			<thead>
				<tr>
					<th scope="col">序号</th>
					<th scope="col">商品</th>
					<th scope="col">日期</th>
				</tr>
			</thead>
			<tbody>
				<tr class="table-info" v-for="(a,index) in aa" :key="index">
					<th scope="row">{{index+1}}</th>
					<td>{{a.commodityName}}</td>
					<td>{{a.sj}}</td>
				</tr>
			</tbody>
		</table>
	</div>
</template>

<script>
	export default {
		name: 'Member',
		data() {
			return {
				aa: []
			}
		},
		mounted() {
			this.$bus.$on('record', (recordData,date) => {
				// 将时间作为一个新的属性添加到recordData对象中 在把recordData添加到aa数组中
				console.log(recordData)
				recordData.sj = date
				this.aa.push(recordData)
				console.log(this.aa)
			})
		}
	}
</script>

<style scoped>

</style>
